<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header('修改地点')"></head>
<head th:include="include :: header('修改地点')"></head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-fantasyCitymap-edit" th:object="${fantasyCitymap}">
            <input id="id" name="id" th:field="*{id}"  type="hidden">
			<div class="form-group">
				<label class="col-sm-1 control-label">城市</label>
				<div class="col-sm-3">
					<select id="cityid" name="cityid" class="form-control">
						<option value="">全部</option>
						<option th:each="city:${cities}" th:alt-title="${city.citydesc}" th:value="${city.id}" th:text="${city.cityname}" th:selected="${fantasyCitymap.cityid == city.id}" value="1">
							aaa
						</option>
					</select>
				</div>
			</div>

			<div class="form-group">
				<label class="col-sm-1 control-label" for="northwest">西北</label>
				<div class="col-sm-3">
					<select class="form-control" id="northwest" name="northwest" onchange="change(this);">
						<option value="0">请选择</option>
						<option value="-1">新节点</option>
						<option th:each="map:${maps}" th:alt-title="${map.placedesc}" th:value="${map.id}" th:text="${map.placename + '(' + map.cityname + ')'}" th:selected="${fantasyCitymap.northwest == map.id}" value="1">
							新节点1
						</option>
					</select>
				</div>
				<label class="col-sm-1 control-label" for="north">北</label>
				<div class="col-sm-3">
					<select class="form-control" id="north" name="north" onchange="change(this);">
						<option value="0">请选择</option>
						<option value="-1">新节点</option>
						<option th:each="map:${maps}" th:alt-title="${map.placedesc}" th:value="${map.id}" th:text="${map.placename + '(' + map.cityname + ')'}" th:selected="${fantasyCitymap.north == map.id}" value="1">
							新节点1
						</option>
					</select>
				</div>
				<label class="col-sm-1 control-label" for="northeast">东北</label>
				<div class="col-sm-3">
					<select class="form-control" id="northeast" name="northeast" onchange="change(this);">
						<option value="0">请选择</option>
						<option value="-1">新节点</option>
						<option th:each="map:${maps}" th:alt-title="${map.placedesc}" th:value="${map.id}" th:text="${map.placename + '(' + map.cityname + ')'}" th:selected="${fantasyCitymap.northeast == map.id}" value="1">
							新节点1
						</option>
					</select>
				</div>
			</div>

			<div class="form-group">
				<label class="col-sm-1 control-label" for="west">西</label>
				<div class="col-sm-3">
					<select class="form-control" id="west" name="west" onchange="change(this);">
						<option value="0">请选择</option>
						<option value="-1">新节点</option>
						<option th:each="map:${maps}" th:alt-title="${map.placedesc}" th:value="${map.id}" th:text="${map.placename + '(' + map.cityname + ')'}" th:selected="${fantasyCitymap.west == map.id}" value="1">
							新节点1
						</option>
					</select>
				</div>
				<label class="col-sm-1 control-label" for="placename">地名</label>
				<div class="col-sm-3">
					<input class="form-control" id="placename" name="placename" th:field="*{placename}"/>
				</div>
				<label class="col-sm-1 control-label" for="east">东</label>
				<div class="col-sm-3">
					<select class="form-control" id="east" name="east" onchange="change(this);">
						<option value="0">请选择</option>
						<option value="-1">新节点</option>
						<option th:each="map:${maps}" th:alt-title="${map.placedesc}" th:value="${map.id}" th:text="${map.placename + '(' + map.cityname + ')'}" th:selected="${fantasyCitymap.east == map.id}" value="1">
							新节点1
						</option>
					</select>
				</div>
			</div>

			<div class="form-group">
				<label class="col-sm-1 control-label" for="southwest">西南</label>
				<div class="col-sm-3">
					<select class="form-control" id="southwest" name="southwest" onchange="change(this);">
						<option value="0">请选择</option>
						<option value="-1">新节点</option>
						<option th:each="map:${maps}" th:alt-title="${map.placedesc}" th:value="${map.id}" th:text="${map.placename + '(' + map.cityname + ')'}" th:selected="${fantasyCitymap.southwest == map.id}" value="1">
							新节点1
						</option>
					</select>
				</div>
				<label class="col-sm-1 control-label" for="south">南</label>
				<div class="col-sm-3">
					<select class="form-control" id="south" name="south" onchange="change(this);">
						<option value="0">请选择</option>
						<option value="-1">新节点</option>
						<option th:each="map:${maps}" th:alt-title="${map.placedesc}" th:value="${map.id}" th:text="${map.placename + '(' + map.cityname + ')'}" th:selected="${fantasyCitymap.south == map.id}" value="1">
							新节点1
						</option>
					</select>
				</div>
				<label class="col-sm-1 control-label" for="southeast">东南</label>
				<div class="col-sm-3">
					<select class="form-control" id="southeast" name="southeast" onchange="change(this);">
						<option value="0">请选择</option>
						<option value="-1">新节点</option>
						<option th:each="map:${maps}" th:alt-title="${map.placedesc}" th:value="${map.id}" th:text="${map.placename + '(' + map.cityname + ')'}" th:selected="${fantasyCitymap.southeast == map.id}" value="1">
							新节点1
						</option>
					</select>
				</div>
			</div>

			<div class="form-group">
				<label class="col-sm-2 control-label">地点描述：</label>
				<div class="col-sm-10">
					<textarea id="placedesc" name="placedesc" rows="5" class="form-control" th:field="*{placedesc}"></textarea>
				</div>
			</div>

			<div class="form-group">
				<label class="col-sm-2 control-label">备注信息：</label>
				<div class="col-sm-10">
					<textarea id="remark" name="remark" rows="5" class="form-control" th:field="*{remark}"></textarea>
				</div>
			</div>
		</form>
    </div>
    <div th:include="include::footer"></div>
    <script type="text/javascript">
		var prefix = ctx + "fantasy/fantasyCitymap"
		$("#form-fantasyCitymap-edit").validate({
			rules:{
				xxxx:{
					required:true,
				},
			}
		});
		
		function submitHandler() {
	        if ($.validate.form()) {
	            $.operate.save(prefix + "/edit", $('#form-fantasyCitymap-edit').serialize());
	        }
	    }


        function change(obj) {
            if ("-1" == obj.value) {
                var inputstr = "<input id=\""+obj.id+"Input\" name=\""+obj.id+"Input\"  class='form-control'></input>";
                $("#" + obj.id).after(inputstr);
            } else {
                $("#" + obj.id + "Input").remove();
            }
        }
	</script>
</body>
</html>
